Skip to content

feat: relay scratch run events to the listening parent app#1496

Merged
DNR500 merged 1 commit into
mainfrom
relay-scratch-run-events
Jun 12, 2026
Merged

feat: relay scratch run events to the listening parent app#1496
DNR500 merged 1 commit into
mainfrom
relay-scratch-run-events

Conversation

@DNR500

@DNR500 DNR500 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Relates to issues:
1484

This will likely need the changes from
1483 to be seen to work full stack

There as a draft PR that will capture the even in editor-standalone -

https://github.com/RaspberryPiFoundation/editor-standalone/pull/954

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new “run started” signal to the Scratch embedding flow, relaying Scratch VM run-start events from the Scratch iframe up to the parent editor app as a standard editor-runStarted custom event (per issue #1484).

Changes:

  • Register a Scratch VM PROJECT_RUN_START listener in the Scratch GUI integration layer and post a scratch-gui-project-run-started message to the parent window.
  • In the parent app, listen for scratch-gui-project-run-started and dispatch a corresponding editor-runStarted CustomEvent.
  • Add unit tests covering listener registration/cleanup and event relay behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/components/ScratchEditor/ScratchIntegrationHOC.jsx Hooks Scratch VM PROJECT_RUN_START to post a scratch-gui-project-run-started message.
src/components/ScratchEditor/ScratchIntegrationHOC.test.jsx Tests VM listener registration/removal and message posting on run start.
src/components/Editor/Project/ScratchContainer.jsx Listens for scratch-gui-project-run-started and dispatches editor-runStarted.
src/components/Editor/Project/ScratchContainer.test.js Tests that the editor-runStarted event is dispatched and not dispatched after unmount.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zetter-rpf zetter-rpf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

@DNR500 DNR500 merged commit 78b3328 into main Jun 12, 2026
8 checks passed
@DNR500 DNR500 deleted the relay-scratch-run-events branch June 12, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants